import axios from "axios";
import Nprogress from "nprogress";
import "nprogress/nprogress.css";

let requst = axios.create({
  baseURL: "/haha",
  timeout: 5000,
});

requst.interceptors.request.use((config) => {
  Nprogress.start();
  return config;
});

requst.interceptors.response.use(
  (res) => {
    Nprogress.done();
    return res.data;
  },
  () => {
    return Promise.reject();
  }
);

export default requst;
